//
//  CustomNavController.m
//  testLLLL
//
//  Created by ads on 16/1/15.
//  Copyright © 2016年 ads. All rights reserved.
//

#import "CustomNavController.h"
//#import "UIViewController+XMGExtension.h"

@interface CustomNavController () <UIGestureRecognizerDelegate>

@end

@implementation CustomNavController

+(void)initialize{
    /**
     *  如果需要设置UINavigationBar 在此设置
     */
//    NSMutableDictionary  * textAtts = [NSMutableDictionary dictionary];
//    textAtts[NSForegroundColorAttributeName]= [UIColor blackColor];//设置文字颜色
//    textAtts[NSFontAttributeName] = [UIFont navControllerTitleFont];//设置文字大小
//    UINavigationBar * nab = [UINavigationBar appearance];
//    nab.translucent = NO;
//    [nab setTitleTextAttributes:textAtts];
    
    NSMutableDictionary  * textAtts = [NSMutableDictionary dictionary];
    textAtts[NSForegroundColorAttributeName]= [UIColor blackNavControllerTitleColor];//设置文字颜色
    textAtts[NSFontAttributeName] = [UIFont navControllerTitleFont];//设置文字大小
    UINavigationBar * nab = [UINavigationBar appearance];
    nab.tintColor = [UIColor blackNavControllerTitleColor];
    nab.translucent = NO;
    nab.barTintColor = [UIColor whiteColor];

    [nab setTitleTextAttributes:textAtts];
    
}

- (void)customSetting {
    NSMutableDictionary  * textAtts = [NSMutableDictionary dictionary];
    textAtts[NSForegroundColorAttributeName]= [UIColor blackNavControllerTitleColor];//设置文字颜色
    textAtts[NSFontAttributeName] = [UIFont navControllerTitleFont];//设置文字大小
    self.navigationBar.translucent = NO;
    self.navigationBar.barTintColor = [UIColor grayBackgroundColor];
    [self.navigationBar setTitleTextAttributes:textAtts];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count>0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.interactivePopGestureRecognizer.delegate = (id)self;
}


- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if (self.viewControllers.count == 1) {
        return NO;
    }
    return YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
